package com.cn.dream_order_server.async;


import com.cn.dream_order_server.pojo.UserSite;
import com.cn.dream_order_server.util.JsonUtils;
import com.cn.dream_order_server.client.UserSiteServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.concurrent.Future;

@Async
@Component
public class UserSiteServerAsync {

    @Autowired
    private UserSiteServer userSiteServer;

    public Future<List<UserSite>> getUserSiteListByUserId(){
        String siteList = userSiteServer.getSiteList();
        List list = JsonUtils.stringToObj(siteList, List.class);
        return new AsyncResult<List<UserSite>>(list);
    }

}
